package com.hbq.codedemopersion.common.model;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum UserStatusEnum {

    OPERATION("1", "正常"),
    COMPLETED("0", "禁用");

    UserStatusEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    private String code;
    private String name;

    public static UserStatusEnum codeOf(String code) {
        for (UserStatusEnum rebateLevelEnum : UserStatusEnum.values()) {
            if (Objects.equals(rebateLevelEnum.getCode(), code)) {
                return rebateLevelEnum;
            }
        }
        return OPERATION;
    }
}
